/*
 * VariableSizeRecordSerializer.h
 *
 *  Created on: Oct 23, 2012
 *      Author: m
 */

#ifndef VARIABLESIZESERIALIZER_H_
#define VARIABLESIZESERIALIZER_H_

#include <list>
#include <memory>
#include <cassert>
#include <cstring>
#include "physical_layer_commons.h"

namespace physical
{

template <typename T> class VariableSizeRecordSerializer
{
public:
    typedef std::shared_ptr<T> _T_ptr;
    typedef T _T;

public:
    virtual ~VariableSizeRecordSerializer(){};

    // Interfáz estática
    virtual size_t serialize( const T &element, byteStream block ) = 0;
    virtual size_t deserialize( const byteStream block, T &element ) = 0;
    virtual size_t computeSize( const T &element ) = 0;

    // Interfáz dinámica
    virtual size_t serialize( const _T_ptr &element, byteStream block ) = 0;
    virtual size_t deserialize( const byteStream block, _T_ptr &elementPtr ) = 0;
    virtual size_t computeSize( const _T_ptr &element )  = 0;
};

} /* namespace physical */
#endif /* VARIABLESIZESERIALIZER_H_ */
